package com.nidu.demo.notify;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.notify.api.SysNotifyTemplateService;
import com.nidu.demo.notify.dto.*;

import com.nidu.demo.notify.executor.command.NotifyTemplateAddCmdExe;
import com.nidu.demo.notify.executor.command.NotifyTemplateDeleteCmdExe;
import com.nidu.demo.notify.executor.command.NotifyTemplateUpdateCmdExe;
import com.nidu.demo.notify.executor.query.NotifyTemplateListQryExe;
import com.nidu.demo.notify.executor.query.NotifyTemplatePageQryExe;
import com.nidu.demo.notify.executor.query.NotifyTemplateSingleQryExe;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * 站内信消息模板服务实现类
 *
 * @author auto
 */
@Service
@RequiredArgsConstructor
public class SysNotifyTemplateServiceImpl implements SysNotifyTemplateService {

    private final NotifyTemplateAddCmdExe addCmdExe;
    private final NotifyTemplateUpdateCmdExe updateCmdExe;
    private final NotifyTemplateDeleteCmdExe deleteCmdExe;
    private final NotifyTemplateSingleQryExe singleQryExe;
    private final NotifyTemplateListQryExe listQryExe;
    private final NotifyTemplatePageQryExe pageQryExe;

    @Override
    public Response add(NotifyTemplateAddCmd cmd) {
        return addCmdExe.execute(cmd);
    }

    @Override
    public Response update(NotifyTemplateUpdateCmd cmd) {
        return updateCmdExe.execute(cmd);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<NotifyTemplateCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public MultiResponse<NotifyTemplateCO> list(NotifyTemplateListQry qry) {
        return listQryExe.execute(qry);
    }

    @Override
    public PageResponse<NotifyTemplateCO> page(NotifyTemplatePageQry qry) {
        return pageQryExe.execute(qry);
    }

}
